UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CuE2jcWNbXXBoSjrUDJqPcKT12O4MZFlCW9YmMhn8eY=' 
WHERE 
  key_id = '15d51a393ee40c07709dd828ed8eed8b73e208810fcaa0f13081aab31b82865d' 
  AND (
    token = 'CuE2jcWNbXXBoSjrUDJqPcKT12O4MZFlCW9YmMhn8eY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051