UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b9twuW7Ir7ZEJF+5NuoEnpsR/hfb8wPueFIIR9ZlsP8=' 
WHERE 
  key_id = 'd18abd3e9dc2a1cb093f8d9f5ffb1c7158260f05241e88362baa61a434f30978' 
  AND (
    token = 'b9twuW7Ir7ZEJF+5NuoEnpsR/hfb8wPueFIIR9ZlsP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050