UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ixDU3femJPTBflOs9x2kV8BITfMC3DhH+vWO1psZzmc=' 
WHERE 
  key_id = 'afb3d72888971d3509ee34b639dd1838199677be8368b5bfdb55c39bfa176715' 
  AND (
    token = 'ixDU3femJPTBflOs9x2kV8BITfMC3DhH+vWO1psZzmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016