UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UNvsJuamcPKSrkUgbys5YqqInKIIXyl+ePKaA87Vd3o=' 
WHERE 
  key_id = '354f2f54cf5649e352449689cdb061b74be32e888d96aab1da35707151c7e715' 
  AND (
    token = 'UNvsJuamcPKSrkUgbys5YqqInKIIXyl+ePKaA87Vd3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032