UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ReBQIXzhOhSaQnl0PYyDfcyN/URPWXx/hk8C8tBFeTM=' 
WHERE 
  key_id = '4b0441810ab35dc6c90dcff3f174acc0ea5972d99b71b9568c969914f5ba8f1a' 
  AND (
    token = 'ReBQIXzhOhSaQnl0PYyDfcyN/URPWXx/hk8C8tBFeTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024