UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gmq5FwVAS9UO+nnPh7kWvPIlguOzbQLdi8LGUaReeMM=' 
WHERE 
  key_id = '7d3820d505e1bfd8332c1e5f31d714a06e3da7689bdfe27a3345a26369fb4834' 
  AND (
    token = 'Gmq5FwVAS9UO+nnPh7kWvPIlguOzbQLdi8LGUaReeMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024