UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uCSDzJS6vk6pS+iB3gf2qzVKumVvSzBOXGr9fCeqFQ8=' 
WHERE 
  key_id = '9d7d1d97aa23a5802812900e6d007ac04eea140803ef9fc10eaaf50d37837af4' 
  AND (
    token = 'uCSDzJS6vk6pS+iB3gf2qzVKumVvSzBOXGr9fCeqFQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048