UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vmOgGKkKresyKviNyCMcXFpgDaMFx5OzBUU224xDgdI=' 
WHERE 
  key_id = 'ab859e707b05a3cdc1219e91e825d3635b0404ad587b2a7af8d72a28242b19f1' 
  AND (
    token = 'vmOgGKkKresyKviNyCMcXFpgDaMFx5OzBUU224xDgdI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079