UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DGY5Vz63CjFb4Y/pwdOn9HardbgVsEP1GY8p17fBhFs=' 
WHERE 
  key_id = 'b22d39aa7283371ed0602c620aa0fc3173879cf102815e6db8e462778149246b' 
  AND (
    token = 'DGY5Vz63CjFb4Y/pwdOn9HardbgVsEP1GY8p17fBhFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027