UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6F3BMMebRpzxXTwynTpkQvHqfKC5KmP3LyQ1Y7cTTlA=' 
WHERE 
  key_id = '85c25205b7b140de6be469942206e6c2c2adfd8eeb66c76209a5d4dd8ca8a638' 
  AND (
    token = '6F3BMMebRpzxXTwynTpkQvHqfKC5KmP3LyQ1Y7cTTlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025