UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'khkMftRCNHVd58pwn+I20MG5pSKHOQe71sZlq3+nyCs=' 
WHERE 
  key_id = '452ef1596ef3957338987b9d1aedc555d7b77d9a91be3b920745926bce192b75' 
  AND (
    token = 'khkMftRCNHVd58pwn+I20MG5pSKHOQe71sZlq3+nyCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028