UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eaGv+8XR5z/b0gT+NhXGMIipRYZsk4056affGjvYl3k=' 
WHERE 
  key_id = '1f7eb46d3989ad134c5168b567f0da72a892765a82739ba2754a9e4f226e31a5' 
  AND (
    token = 'eaGv+8XR5z/b0gT+NhXGMIipRYZsk4056affGjvYl3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020