UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Vv+SXSzXAv6GRmZX+WsFYMCfaGlgOPjxlwho/TdDQ0=' 
WHERE 
  key_id = 'e8702881e61c1ee1438c0d92b411cf7d7b1234ae9a930a113be5b44918be5174' 
  AND (
    token = '8Vv+SXSzXAv6GRmZX+WsFYMCfaGlgOPjxlwho/TdDQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047