UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cguyoS6BNljCmwgvk/3MPQ3OZnPBAj7FbWjcQnnKRA8=' 
WHERE 
  key_id = 'b8ee7e1e7fe5caec48d7db3dee4f139e172234498e63380ad2aee113630e5962' 
  AND (
    token = 'cguyoS6BNljCmwgvk/3MPQ3OZnPBAj7FbWjcQnnKRA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030