UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K9tMme5gJFUR38M6Xndlr9rvikKSh+FOvicVsncrHQA=' 
WHERE 
  key_id = '10031f9c07d5d4fa186482485ce064262a2b8e0253952221ee2f7a4c0c3f205e' 
  AND (
    token = 'K9tMme5gJFUR38M6Xndlr9rvikKSh+FOvicVsncrHQA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045