UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'myYfBMx+ivGWynZHNHomYNhoeTcloWwGggKi5R/aPOU=' 
WHERE 
  key_id = 'cef20639b9d809bf1a10d04f9d6039a06840861ec06faf95dc49409e9affa526' 
  AND (
    token = 'myYfBMx+ivGWynZHNHomYNhoeTcloWwGggKi5R/aPOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027