UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X+FJQfFzcKkob2yDDpuQk4D8KXSza/ahGPM+e6DCmiU=' 
WHERE 
  key_id = '01f2621a4a0d042e10a0e43fab2251808b7a2179028acb5764d43458ccaa7ee7' 
  AND (
    token = 'X+FJQfFzcKkob2yDDpuQk4D8KXSza/ahGPM+e6DCmiU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047