UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cegz3VlxecqoO6UlCkVWgpczSHdBeepaw+20D6sqtTg=' 
WHERE 
  key_id = '6e5b1f2b835dfba97ec964eb4b378c8b369ce2f53d57550d7ea43b93dbe9501c' 
  AND (
    token = 'Cegz3VlxecqoO6UlCkVWgpczSHdBeepaw+20D6sqtTg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058