UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wgSAnOw4+XcIMlBCnCBM5b50BjSoZOaIYBhxspf7blQ=' 
WHERE 
  key_id = '84108370d8e92c9175139bf41628b39c132f74f4e39484d31dd283959d033c9b' 
  AND (
    token = 'wgSAnOw4+XcIMlBCnCBM5b50BjSoZOaIYBhxspf7blQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024