UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n9x3My0qEcf2KRz3VSR6gSX/igZpfFKDEOYhHIYo/os=' 
WHERE 
  key_id = '2650aa99b78317d148b5ccd7d1d2970a5463522d9c414e69c58ef65ddd08a0f1' 
  AND (
    token = 'n9x3My0qEcf2KRz3VSR6gSX/igZpfFKDEOYhHIYo/os=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026