UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FhbJ1cxEkwGSBPZ+R/SiRtHNvTyPxygiglrt3ACKswM=' 
WHERE 
  key_id = 'd10485a4d61f83bb1abdffb88b20b91dc9d331c5182d4879547e20f6ec351f39' 
  AND (
    token = 'FhbJ1cxEkwGSBPZ+R/SiRtHNvTyPxygiglrt3ACKswM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023