UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8NoWI6i0GABZ2cXiDO1jEtTCURAIng44NCN6mr+EMPI=' 
WHERE 
  key_id = '6871e40f774095c1b74973ab1096b8f3ba3264e20a102b413520eb9a82cfdf04' 
  AND (
    token = '8NoWI6i0GABZ2cXiDO1jEtTCURAIng44NCN6mr+EMPI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049