UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fo7aLJYPHOzSxaf3BfrNPFqVAMB8weOxe4x6QCyPHCA=' 
WHERE 
  key_id = '560879eee2d1aa9d7df3682cca4b24ec6b77061fbef6d7e78d13af5e6600f301' 
  AND (
    token = 'Fo7aLJYPHOzSxaf3BfrNPFqVAMB8weOxe4x6QCyPHCA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050