UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UY2nqd5tDbeO8HSjkvXSTTvXRoj36esFCfQWtoyaKkM=' 
WHERE 
  key_id = '868bfb95b338d9eee982d213dcfe9100b02f1849ae829793a6d1c032bec782ac' 
  AND (
    token = 'UY2nqd5tDbeO8HSjkvXSTTvXRoj36esFCfQWtoyaKkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041