UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qtREQfg+AZwbjb/H87emFYb1WNVllruWpclQ2gTiqck=' 
WHERE 
  key_id = '064f8cba9ab91543d723de5a9dcd45b954b90fe8edd0caa7827f5cdbb104f8d3' 
  AND (
    token = 'qtREQfg+AZwbjb/H87emFYb1WNVllruWpclQ2gTiqck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033