UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZScHmYzN8KWD5H5Y6qgTDCaAtPKrn3NMkH4bPjicDWA=' 
WHERE 
  key_id = '56f32600c155260b2beea0b279b432609eb3286e131a025379f989d55eaf7819' 
  AND (
    token = 'ZScHmYzN8KWD5H5Y6qgTDCaAtPKrn3NMkH4bPjicDWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032