UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v3LdEKJu2tzPRwOgcJF2iMkNucgDk/XjLnHAFCexsRY=' 
WHERE 
  key_id = '10a56f60807c055a85cb64716e8b7350f8d3be3a8c13bc547a2fbc6435507a9e' 
  AND (
    token = 'v3LdEKJu2tzPRwOgcJF2iMkNucgDk/XjLnHAFCexsRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025