UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UQMxt/zz1hHxlTYciCWPjCPAozJ1dGJsMDLLIDDgMo8=' 
WHERE 
  key_id = '0c004a27e59ff01488ee72feb786bf1740bd7b420f184b47916b3f98796a809d' 
  AND (
    token = 'UQMxt/zz1hHxlTYciCWPjCPAozJ1dGJsMDLLIDDgMo8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025