UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '50/jzrxYlc2o171pBa/nWK3L3IMccEHj6S+rPaYk3Gg=' 
WHERE 
  key_id = '13cf3df31e15f531b97176feb8da0327f2472708b814b57effec524d268683d2' 
  AND (
    token = '50/jzrxYlc2o171pBa/nWK3L3IMccEHj6S+rPaYk3Gg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029