UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SaWw0hE3GZQFyNDwuolLGdQjkvTpTKzhMxaGSxc5HbM=' 
WHERE 
  key_id = '77c792f0dee6f4f2e17ffa0a149b629465b12845f3e2afba0a3a8c332765b2f7' 
  AND (
    token = 'SaWw0hE3GZQFyNDwuolLGdQjkvTpTKzhMxaGSxc5HbM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027