UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Un4bchtGOiWvhMZ8t7wtMB4BxQoGP03mMEc5ftQsPD0=' 
WHERE 
  key_id = '8c6ca39178a14ccf763d18b4b6da93069c12aec139fe772f260758d450679849' 
  AND (
    token = 'Un4bchtGOiWvhMZ8t7wtMB4BxQoGP03mMEc5ftQsPD0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026