UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X3l2jcjLjc2Mc9uWvNHttu5UB7GPlSEkxP5uifWeJwY=' 
WHERE 
  key_id = '122c9c19c9155d179998d0d9c0b262dbc10c4f5f8f481022f0496fab243640ac' 
  AND (
    token = 'X3l2jcjLjc2Mc9uWvNHttu5UB7GPlSEkxP5uifWeJwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049