UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z42tJOMFb4XO/zYn8NU4VZKZ6nXs6x2oD5Xva58Su7M=' 
WHERE 
  key_id = '674be637205909e0ee673cafaeba0f217775d7d226f3868930c8c3d1144f7587' 
  AND (
    token = 'Z42tJOMFb4XO/zYn8NU4VZKZ6nXs6x2oD5Xva58Su7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036