UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'grZnCPy9SSBrSzzV62GUBLYbKihgmPshdS3UHFN9VDk=' 
WHERE 
  key_id = 'f0ccedeafe976fe60aaaf3a3e4c3aa7c49de0e109771ca244b9b0027bc26e328' 
  AND (
    token = 'grZnCPy9SSBrSzzV62GUBLYbKihgmPshdS3UHFN9VDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00107