UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ob1QR/FfWcY4/cEvfmeBc4C37A4JLCLnZb793mU6Ng0=' 
WHERE 
  key_id = '475dee7b849b0577d21ca8ad123b353ec66b8dc947e5664dca2742496dacb42f' 
  AND (
    token = 'ob1QR/FfWcY4/cEvfmeBc4C37A4JLCLnZb793mU6Ng0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043