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

Query time 0.00035