UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HTbJ+B2wh01X3m9dCU2vaU/Xs4AHdfIdNoKcsn/C/Kk=' 
WHERE 
  key_id = 'd22bc7c51ec0ca70d4a67afdfbd296c062aa8361973b149538502678cfc0473b' 
  AND (
    token = 'HTbJ+B2wh01X3m9dCU2vaU/Xs4AHdfIdNoKcsn/C/Kk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046