UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7n6zuBijPOvnBUMjv1igSq/I0ptn8C10e16xIzq8KC8=' 
WHERE 
  key_id = 'a2d18817db7a6a7ee1caa06b08433c53e2eee5d464908cd239c52ac5750b441f' 
  AND (
    token = '7n6zuBijPOvnBUMjv1igSq/I0ptn8C10e16xIzq8KC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039