UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4WtDARvBbBXSnI9uB6OXtqQym1+WkuoGNRu2P/T40TM=' 
WHERE 
  key_id = '2a280d0adf47420c641e7bac10b2b0038d358e6e1477a0e74f55f6053009389c' 
  AND (
    token = '4WtDARvBbBXSnI9uB6OXtqQym1+WkuoGNRu2P/T40TM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032