UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TM/73NRBoSKu/bI2LL+MS5mbhoLgXk4Pb8m2VfYkMCo=' 
WHERE 
  key_id = '122bd000d07efef965aa90d2dbe0e529f3bf565504eb6932711d5e18fca84721' 
  AND (
    token = 'TM/73NRBoSKu/bI2LL+MS5mbhoLgXk4Pb8m2VfYkMCo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032