UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oURAdN+COAiEwg0BLkvOdfw8SrLWzS+pZvPNV3+szEs=' 
WHERE 
  key_id = '24cf17f8160223ccf531f4f025bedd5b6692a79eb4982c1edc93a7d07aca5d5c' 
  AND (
    token = 'oURAdN+COAiEwg0BLkvOdfw8SrLWzS+pZvPNV3+szEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032