UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X5+7w8Xt8rZaJ+erv0RuUMTunOkn02idPVOGofzef2o=' 
WHERE 
  key_id = '388f3163e5a8fac3e3c6becec81e97a5b9d8ee658204faba3ba3612e99379ac4' 
  AND (
    token = 'X5+7w8Xt8rZaJ+erv0RuUMTunOkn02idPVOGofzef2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054