UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sdim3siBV6lcY4319nbUfYBXuMIDxdOF52wFJSG61WM=' 
WHERE 
  key_id = 'a6b0e9b0fd6a3183579f2396dc1f09d0455d6b5c653a23abb77f12ed6e26e9ff' 
  AND (
    token = 'sdim3siBV6lcY4319nbUfYBXuMIDxdOF52wFJSG61WM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025