UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CZQFnUh5J7+67rhlYGYiANJTlZ8RNj5XwWSqHyRIaH0=' 
WHERE 
  key_id = '5d41ae8795adfe165824af9a81308270c193ec4cbd6313d2209e4398353e1385' 
  AND (
    token = 'CZQFnUh5J7+67rhlYGYiANJTlZ8RNj5XwWSqHyRIaH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028