UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J0PPma17PHhcP1aUAABqxvIfygvwQoVrIRu9hzJRo+Y=' 
WHERE 
  key_id = 'b025ebb9ba9e79bd927774f2c4c36243c03444a6cf004af90aa400f362b52bc4' 
  AND (
    token = 'J0PPma17PHhcP1aUAABqxvIfygvwQoVrIRu9hzJRo+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016